Fix flaky test: TestO11y/http_with_token#1248
Open
circleci-app[bot] wants to merge 1 commit intomainfrom
Open
Conversation
pete-woods
reviewed
Aug 6, 2025
Comment on lines
+138
to
+141
| if len(traces) >= 1 { | ||
| return poll.Success() | ||
| } | ||
| return poll.Continue("only got %d traces", len(traces)) |
Contributor
There was a problem hiding this comment.
Suggested change
| if len(traces) >= 1 { | |
| return poll.Success() | |
| } | |
| return poll.Continue("only got %d traces", len(traces)) | |
| return poll.Compare(cmp.Len(traces, 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔧 Flaky Tests Analysis & Fixes
This PR contains a fix for one flaky test that was causing reliability issues due to timing-based race conditions.
📋 Tests Fixed
o11y/otel/otel_test.go: Fixed race condition inTestO11y/http_with_tokensubtest by adding proper polling pattern for trace retrieval from JaegerNone. The single analyzed test was successfully fixed.
🛠️ Types of Changes Made
🔍 Common Patterns Identified
The test exhibited timing-based flakiness due to a race condition between trace creation/flushing and trace retrieval from Jaeger. The fix involved implementing a proven polling pattern already used elsewhere in the codebase.
✅ Expected Impact
This targeted fix should improve test reliability by addressing the race condition where the "find trace" subtest was directly querying Jaeger without waiting for traces to be indexed, causing intermittent failures when Jaeger hadn't processed the traces yet.
Total Tests Analyzed: 1 | Successfully Fixed: 1 | Test Files Modified: 1 | Total Cost: $0.89 | Generated: 2025-08-06